%{
    This file is part of StemCellQC, a video bioinformatics software
    toolkit for analysis of phase contrast microscopy videos.
    Copyright 2013-2015 Vincent On. [vincenton001-at-gmail.com]

    StemCellQC is free software: you can redistribute it and/or 
    modify it under the terms of the GNU General Public License as 
    published by the Free Software Foundation, either version 3 of the 
    License, or (at your option) any later version.

    StemCellQC is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with StemCellQC.  If not, see <http://www.gnu.org/licenses/>.
%}

function cc_im = im2color_channel(im, color)

if length( im( 1, 1, : )) == 3
    im = rgb2gray( im );
end
[ m, n ] = size( im );
temp = zeros( m, n, 3 );
temp = uint8( temp );
switch color
    case 3%'red'
        temp(:,:,1) = im;
    case 1%'green'
        temp(:,:,2) = im;
    case 2%'blue'
        temp(:,:,3) = im;
    case 4%'yellow'
        temp(:,:,1) = im;
        temp(:,:,2) = im;
    case 5%'cyan'
        temp(:,:,2) = im;
        temp(:,:,3) = im;
    case 6%'purple'
        temp(:,:,1) = im;
        temp(:,:,3) = im;
    case 7%'cyan'
        temp(:,:,1) = im;
        temp(:,:,2) = im;
        temp(:,:,3) = im;
end

cc_im = temp;